#!/usr/bin/env groovy
package com.yidao.www

// Ansible auto deploy
def autoDeploy(tag){

    def playbookProfile = playbookProfile(tag)
    def gitUrl = playbookProfile.gitUrl
    def branch = playbookProfile.branch
    def targetDir = playbookProfile.targetDir
    def hosts = playbookProfile.hosts
    def site = playbookProfile.site

    def base = new base()

    stage('deploy to dev server'){

        // println ===================ansible info===================
        // println "gitUrl: " + gitUrl
        // println "branch: " + branch
        // println "targetDir: " + targetDir
        // println "hosts: " + hosts
        // println "site: " + site
        // println ===================ansible info===================

        base.gitCheckout(gitUrl, branch, targetDir)
        base.playbook(tag)

    }
}